package com.htpro.controller;

import com.htpro.pojo.Typef;
import com.htpro.pojo.Userinfo;
import com.htpro.service.UserService;
import com.htpro.service.UserinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
public class UserinfoController {
    @Autowired
    private UserinfoService us;
    @GetMapping("/selectUserinfo/{uid}")
    public Userinfo selectUserinfo(@PathVariable("uid") Integer uid){
        Userinfo userinfo= us.selectUserinfo(uid);
        return userinfo;
    }
    @GetMapping("/updateUserinfo/{uid}/{sex}/{birthday}/{hobby}/{sign}")
    public int updateUserinfo(
            @PathVariable("uid") Integer uid,
            @PathVariable("sex") String sex,
            @PathVariable("birthday") String birthday,
            @PathVariable("hobby") String hobby,
            @PathVariable("sign") String sign){
        Userinfo userinfo=new Userinfo();
        userinfo.setBirthday(birthday);
        userinfo.setHobby(hobby);
        userinfo.setSex(sex);
        userinfo.setUid(uid);
        userinfo.setSign(sign);
        int n=us.updateUserinfo(userinfo);
        return n;
    }
}
